package cn.iocoder.yudao.module.scrm.annotations;

import cn.iocoder.yudao.module.scrm.exception.FieldRepeatValidatorHandler;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 字段唯一校验注解 - 有 单个|多个|外键 注释
 *
 * @Author LiZhiMin
 * @Date 2024/8/21 12:18
 */

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = FieldRepeatValidatorHandler.class)
public @interface FieldRepeatValidators {

    /**
     * 数据表名
     *
     * @return
     */
    String tableName();

    /**
     * 数据表id字段名
     *
     * @return
     */
    String idField() default "id";

    /**
     * id字段的属性名称
     *
     * @return
     */
    String idProperty() default "id";


    FieldRepeatValidator[] fieldRepeatValidators();

    String message() default "";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
